<link rel="stylesheet" href="<?php echo TEMPLATES_PATH;?>/css/university.css" />
<script type="text/javascript" src="<?php echo TEMPLATES_PATH;?>/js/newView.js"></script>
<script type="text/javascript" src="ckplayer/ckplayer.js" charset="utf-8"></script>
<header class="layout head padding-small">
    <a href="javascript:back(true);" class="hBack float-left"></a>
    <h4 class="hTxt float-left text-center text-white">视频中心</h4>
    <a href="javascript:;" id="btnJdkey" class="hHlep float-right"></a>
</header>
<div class="main_content">
		<?php if(!empty($output['university_list']) && is_array($output['university_list'])){?>
        <?php foreach ($output['university_list'] as $_k => $_v) {?>
        	    <!--分享Start-->
<div class="showshare" id="mydialogShare">
    <div class="dialog">
        <div class="dialog-head">
            <span class="close rotate-hover"></span>
            <strong>分享链接</strong>
        </div>
        <div class="dialog-body">
            <div class="share_content">
                <ul class="clearfix text-center padding-none">
                    <li class="x4">
                        <a href="http://connect.qq.com/widget/shareqq/index.html?url=http%3A%2F%2Fwww.d1mcw.com%2Fmobile%2Findex.php%3Fact%3Duniversity_detail%26op%3Dindex%26study_id%3D<?php echo $_v['study_id']?>&amp;desc=%E5%97%A8%EF%BC%8C%E8%80%81%E6%9C%8B%E5%8F%8B%EF%BC%8C%E7%BB%99%E4%BD%A0%E5%88%86%E4%BA%AB%E4%B8%80%E4%B8%AA%E5%A5%BD%E7%BD%91%E7%AB%99%EF%BC%9AD1%E7%BE%8E%E8%B4%A2%E7%BD%91%EF%BC%8C%E5%AE%83%E6%98%AF%E7%BE%8E%E4%B8%9A%E9%A2%86%E5%9F%9F%E7%9A%84%E9%98%BF%E9%87%8C%E5%B7%B4%E5%B7%B4%E3%80%82%E5%8F%AC%E9%9B%86%E4%B8%8A%E5%8D%83%E4%B8%AA%E5%8E%82%E5%AE%B6%E5%92%8C%E5%93%81%E7%89%8C%E8%BF%90%E8%90%A5%E5%95%86%EF%BC%8C%E6%B1%87%E9%9B%86%E6%95%B0%E5%8D%81%E4%B8%87%E7%A7%8D%E7%BE%8E%E5%AE%B9%E7%BE%8E%E5%8F%91%E5%95%86%E5%93%81%EF%BC%8C%E5%8F%AA%E4%B8%BA%E7%BB%99%E6%82%A8%E6%8F%90%E4%BE%9B%E6%9B%B4%E4%BC%98%E8%B4%A8%E4%BD%8E%E4%BB%B7%E7%9A%84%E5%95%86%E5%93%81%E5%92%8C%E6%9B%B4%E5%BF%AB%E6%8D%B7%E6%97%A0%E6%8E%A8%E8%AF%BF%E7%9A%84%E5%94%AE%E5%90%8E%E6%9C%8D%E5%8A%A1%EF%BC%81%E8%AE%A9%E6%82%A8%E8%B6%B3%E4%B8%8D%E5%87%BA%E6%88%B7%EF%BC%8C%E5%92%8C%E5%8E%82%E5%AE%B6%E7%9B%B4%E6%8E%A5%E4%BA%A4%E6%98%93%E3%80%82%E5%BF%AB%E6%9D%A5%E6%B3%A8%E5%86%8C%E7%9C%8B%E7%9C%8B%E5%90%A7%E3%80%82&amp;title=<?php echo $_v['title']?>&amp;pic=<?php echo $_v['study_photo']?>">
                            <p><img src="http://www.d1mcw.com/mobile/templates/images/share/logo_qq.png" width="50%"></p>
                            <p class="text-small">QQ</p>
                        </a>
                    </li>
                    <li class="x4">
                        <a href="http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=http%3A%2F%2Fwww.d1mcw.com%2Fmobile%2Findex.php%3Fact%3Duniversity_detail%26op%3Dindex%26study_id%3D<?php echo $_v['study_id']?>&amp;desc=%E5%97%A8%EF%BC%8C%E8%80%81%E6%9C%8B%E5%8F%8B%EF%BC%8C%E7%BB%99%E4%BD%A0%E5%88%86%E4%BA%AB%E4%B8%80%E4%B8%AA%E5%A5%BD%E7%BD%91%E7%AB%99%EF%BC%9AD1%E7%BE%8E%E8%B4%A2%E7%BD%91%EF%BC%8C%E5%AE%83%E6%98%AF%E7%BE%8E%E4%B8%9A%E9%A2%86%E5%9F%9F%E7%9A%84%E9%98%BF%E9%87%8C%E5%B7%B4%E5%B7%B4%E3%80%82%E5%8F%AC%E9%9B%86%E4%B8%8A%E5%8D%83%E4%B8%AA%E5%8E%82%E5%AE%B6%E5%92%8C%E5%93%81%E7%89%8C%E8%BF%90%E8%90%A5%E5%95%86%EF%BC%8C%E6%B1%87%E9%9B%86%E6%95%B0%E5%8D%81%E4%B8%87%E7%A7%8D%E7%BE%8E%E5%AE%B9%E7%BE%8E%E5%8F%91%E5%95%86%E5%93%81%EF%BC%8C%E5%8F%AA%E4%B8%BA%E7%BB%99%E6%82%A8%E6%8F%90%E4%BE%9B%E6%9B%B4%E4%BC%98%E8%B4%A8%E4%BD%8E%E4%BB%B7%E7%9A%84%E5%95%86%E5%93%81%E5%92%8C%E6%9B%B4%E5%BF%AB%E6%8D%B7%E6%97%A0%E6%8E%A8%E8%AF%BF%E7%9A%84%E5%94%AE%E5%90%8E%E6%9C%8D%E5%8A%A1%EF%BC%81%E8%AE%A9%E6%82%A8%E8%B6%B3%E4%B8%8D%E5%87%BA%E6%88%B7%EF%BC%8C%E5%92%8C%E5%8E%82%E5%AE%B6%E7%9B%B4%E6%8E%A5%E4%BA%A4%E6%98%93%E3%80%82%E5%BF%AB%E6%9D%A5%E6%B3%A8%E5%86%8C%E7%9C%8B%E7%9C%8B%E5%90%A7%E3%80%82&amp;title=<?php echo $_v['title']?>&amp;pics=<?php echo $_v['study_photo']?>">
                            <p><img src="http://www.d1mcw.com/mobile/templates/images/share/logo_qzone.png" width="50%"></p>
                            <p class="text-small">QQ空间</p>
                        </a>
                    </li>
                    <li class="x4">
                        <a href="http://v.t.sina.com.cn/share/share.php?url=http%3A%2F%2Fwww.d1mcw.com%2Fmobile%2Findex.php%3Fact%3Duniversity_detail%26op%3Dindex%26study_id%3D<?php echo $_v['study_id']?>&amp;title=<?php echo $_v['title']?>&amp;pic=<?php echo $_v['study_photo']?>">
                            <p><img src="http://www.d1mcw.com/mobile/templates/images/share/logo_sinaweibo.png" width="50%"></p>
                            <p class="text-small">新浪微博</p>
                        </a>
                    </li>
                </ul>
                <div class="share_copy margin-top" >
                    <p class="border radius-big padding text-red"><?php echo c('site_url') . '/index.php?act=university_detail&op=index&study_id=' . $output['study_id'] . '.html' ?></p>
                    <p style="line-height:24px">长按复制链接</p>
                </div>
            </div>

        </div>
        <div class="dialog-foot">
            <button class="button dialog-close">取消</button>
        </div>
    </div>
</div>

<!-- 分享End -->
        	
        	
        	     <?php }}?>
	<div class="video-con layout">
    	<h2 class="video-title bg-white padding">
        	视频：<span><?php echo universityModel::study_cat_id($_v['study_cat_id'])?></span> —— <span><?php echo $_v['title']?></span><!--视频类型-->
        	<?php if(universityModel::getstudy_price($_v['study_id'])==0 && universityModel::getstudy_points($_v['study_id'])==0){?>
        		
				<em class="text-green">（免费）</em><!--免费的显示免费-->
        	<?}?>
        </h2>
        <div class="video margin">
                <div class="video-play">
                <video width="100%" controls autostart="false" loop id="play">
                    <source src="http://www.d1mcw.com/media/help/pinpaidianpusz.ogg" type="video/ogg" />
                    <source src="http://www.d1mcw.com/media/help/pinpaidianpusz.webm" type="video/webm" />
                    <object type="" width="800" height="480" autostart="false" loop="false" >
                        <param name="wmode" value="opaque" autostart="false" loop="false" >
                        <param name="movie" value="" width="100%" autostart="false" loop="false" >
                    </object>
                </video>
            </div>
            
             	<img id="photo"  src="<?php echo $_v['study_photo']?>" alt="" width="100%" height="100%"/>
                        <video  id="video" width="100%" height="130" controls="controls" autostart="false" loop="false" >
                        </video>
            <!--当视频需要购买，则需购买前下面的遮罩层显示；已购买的及免费的点击播放即可播放观看，遮罩层不显示-->
             <?php if( Db::queryRow("select * from #__study_log where study_id = '".$output['study_id']."' GROUP by member_id")||Db::queryRow("select * from #__study where study_id = '".$output['study_id']."' and study_price = '0' and study_points = '0' ")){?>
             	<?php    } else{?>
            <div class="v-shade layout">
                <div class="v-shade-back layout"></div>
                <p>此视频需要一次性支付<span class="text-red text-big"><span class="text-F39 f20"><?php if($_v['study_price']==0 && $_v['study_points']!=0){
                    		echo "积分".$_v['study_points'];
                    	}else if($_v['study_price']==0 && $_v['study_points']==0){
                    		echo "免费";
                    	} else{
                    		echo "￥".$_v['study_price']."元";
                    	}
                    	?></span></span>学习费<br>
                购买后可以无限次观看学习，也可以进行下载。<br>
                请点击下面的按钮进行购买学习，谢谢!</p>
            </div>
            <?}?>
        </div>
        <td><?php  '<a href="javascript:void(0);" onclick="sel(\''.$_v['vedio_url'].'\')">'.$_v['title'].'</a>';?></td>
        <div class=" bg-white">
            <ul class="layout padding clearfix video-btn ">
              <li class="x2 text-center">
                <img src="<?php echo TEMPLATES_PATH;?>/images/icon1.png" alt="" width="35%">
                <p class="text-small">收藏</p>
              </li>
         <?php if( Db::queryRow("select * from #__study_log where study_id = '".$_v['study_id']."' GROUP by member_id")||Db::queryRow("select * from #__study where study_id = '".$_v['study_id']."' and study_price = '0' and study_points = '0' ")){?>
        		 <li class="x2 text-center"><!--收费，未购买的此按钮不可用-->
                <img src="<?php echo TEMPLATES_PATH;?>/images/icon2.png" alt="" width="35%" onclick="download()" >
              <a href=""  id="xiazai" download=""></a>
             <p class="lh150" >点击下载</p>
             
              </li>
				
        	<?} else {?>
              <li class="x2 text-center"><!--收费，未购买的此按钮不可用-->
                <img src="<?php echo TEMPLATES_PATH;?>/images/icon2.png" alt="" width="35%">
                <p class="text-small">不能下载</p>
              </li>
              <?php }?>
              <li class="x2 text-center" >
               <!-- <a href="javascript:;">-->
               	<a href="#tab-unit" class="share dialogs" data-toggle="click" data-target="#mydialogShare" data-mask="1" data-width="85%">
                    <img src="<?php echo TEMPLATES_PATH;?>/images/icon4.png" alt="" width="35%">
                    <p class="text-small">分享</p>
                </a>
                    <!--<a href="#tab-unit" class="x2 share dialogs" data-toggle="click" data-target="#mydialogShare" data-mask="1" data-width="85%"><span></span><p>分享</p></a>-->
              </li>
                     <?php if(Db::queryRow("select * from #__study where study_id = '".$output['study_id']."' and study_price = '0' and study_points = '0' ")){?>
                     	 <li class="x3 text-center"><!--已购买的显示-->
                <span class="text-green">免费</span>
              </li>
              <?php } else if(Db::queryRow("select * from #__study_log where study_id = '".$output['study_id']."' GROUP by member_id")){              ?>
              		 <li class="x3 text-center"><!--已购买的显示-->
              	<span class="text-red"><?php echo "￥".$_v['study_price']?></span><br>
                <span class="text-green">已购买</span>
              </li>
              	<?php } else{ ?>
              	<span class="text-red">未购买</span>
              		<?php }?>
            </ul>

<span class="pop-attention" style="position:absolute;z-index:9999;display:none" id="save">
 	<span class="icon-succ" id="guanzhu"></span>
</span>
            
            <div class="layout padding"><!--收费 未购买的才显示-->
                <span class="x3 text-red"><?php if($_v['study_price']==0 && $_v['study_points']!=0){
                    		echo "积分".$_v['study_points'];
                    	}else if($_v['study_price']==0 && $_v['study_points']==0){
                    		echo "免费";
                    	} else{
                    		echo "￥".$_v['study_price'];
                    	}
                    	?></span>
                     <?php if(Db::queryAll("select * from #__study where study_id = '".$output['study_id']."' and study_price = '0' and study_points = '0' ") ||(Db::queryAll("select * from #__study_log where study_id = '".$output['study_id']."' and member_id = '".$output['member_id']."'"))){?>
             	<?php    } else{?>	
             		<tr>
                <span class="text-left"><a href="index.php?act=university_detail&op=lesson_order&study_id=<?php echo $_v['study_id']?>&study_cat_id=<?php echo $_v['study_cat_id']?>" class="bg-red text-white buy-btn radius-big ">预存款购买</a></span><!--连接到课程订单页面-->
                <span class="text-right"><a href="index.php?act=order&op=order_pay&study_id=<?php echo $_v['study_id']?>&study_cat_id=<?php echo $_v['study_cat_id']?>" class="bg-green text-white buy-btn radius-big ">在线支付</a></span><!--连接到课程订单页面-->
                <span class="text-left"><a href="index.php?act=university_detail&op=lesson_pointerorder&study_id=<?php echo $_v['study_id']?>&study_cat_id=<?php echo $_v['study_cat_id']?>" class="bg-yellow text-white buy-btn radius-big ">积分兑换</a></span><!--链接到积分订单-->
                
                </tr>
                <?php }?>
                
            </div>
            
            <div class="video-detail border-top padding">
            	<h5>视频介绍：</h5>
                <p class="text-small"><?php echo $_v['study_content']?></p>
            </div>
        </div> 
    </div>

    <!--相关视频  效果和商品推荐相同 S-->
 
<div class="goodsRecommend  bg-white layout padding margin-top">
	<h5 class="padding-bottom">相关课程推荐</h5>
    <div class="gr-list layout">
    	<div ontouchstart="touchStart(event)" ontouchmove="touchMove(event);" ontouchend="touchEnd(event);">
            <ul class="gr-con padding-none" id="slide">
                <?php
                if(!empty($output['studys_commend']) && is_array($output['studys_commend'])){ $i= 0;
                foreach($output['studys_commend'] as $item){ $i++;
                ?>
                <li class="item padding-small border border-red-light text-center radius-big margin-small-right">
                    <a href="index.php?act=university_detail&op=index&study_id=<?php echo $item['study_id']?>&study_cat_id=<?php echo $item['study_cat_id']?>" class="text-left">
                    	<span class="vr-img" ><img src="<?php echo $item['study_photo']?>" alt="" class="layout"></span>
                        <h5 class="text-small gr-goodsName"><?php echo $item['title']?></h5>
                      <span class="v-salePrice text-red text-small "><?php if($_v['study_price']==0 && $_v['study_points']!=0){
                    		echo "积分".$_v['study_points'];
                    	}else if($_v['study_price']==0 && $_v['study_points']==0){
                    		echo "免费";
                    	} else{
                    		echo "￥".$_v['study_price'];
                    	}
                    	?></span>
                    </a>
                </li>
                <?php }?>
                <?php }?>
            </ul>
        </div>
    </div>
</div>
 
</span>
    <!--相关视频 E-->
	<div class="v-footer">
    	<img src="<?php echo TEMPLATES_PATH;?>/images/footer.png" alt="" class="layout">
    </div>
</div>
</body>
</html>
<script type="text/javascript">
				$("#play").hide();
	$(function(){

//		$("#source").hide();
		//判断视频是否收藏了
					var img = $('.video-btn li:eq(0)').find('img');
			$.ajax({
				type:"post",
				dataType:"json",
				url:"index.php?act=university_detail&op=collection_judge",
				data:{study_id:<?php echo $output['study_id']?>},
				success:function(json){
					if(json.success==0){
						img.attr('src','<?php echo TEMPLATES_PATH;?>/images/icon1.png');
					}else{
						img.attr('src','<?php echo TEMPLATES_PATH;?>/images/icon5.png');
					}
				}
			});
		
		
		$('.v-play').height($('.v-img').height());
		$('.video-btn li:eq(0)').click(function(){
			var img = $(this).find('img');
			
			if( img.attr('src') == "<?php echo TEMPLATES_PATH;?>/images/icon5.png" ){
				img.attr('src','<?php echo TEMPLATES_PATH;?>/images/icon1.png');
				
				   $.ajax({
			type:"post",
			url:"index.php?act=university_detail&op=cancel_study_collection",
			dataType:"json",
			data:{study_id:<?php echo $output['study_id']?>},
			success:function(json){
				endTime = new Date().getTime() / 1000 + 3;
			if(json.success==1){
					iconShow("取消收藏视频成功");
				

				}else{
					iconShow("取消收藏视频失败");
				}
			}
		});
				
			}else{
				img.attr('src','<?php echo TEMPLATES_PATH;?>/images/icon5.png');
				     $.ajax({
			type:"post",
			url:"index.php?act=university_detail&op=study_collection",
			dataType:"json",
			data:{study_id:<?php echo $output['study_id']?>},
			success:function(json){
				endTime = new Date().getTime() / 1000 + 3;
				if(json.success==2){
					iconShow("已收藏此视频");
				} else if(json.success==1){
					iconShow("收藏视频成功");
				} else{
					iconShow("收藏视频失败");
				}
			}
		});
					
			}
		})
		var liHeight = $('.item').height()+12;
		$('.vr-list').height(liHeight);
	})
</script>

<script type="text/javascript">
<?php if(!empty($output['university_list']) && is_array($output['university_list'])){?>
        <?php foreach ($output['university_list'] as $_k => $_v) {?>
          
       
       <?php }}?>

	<?php if(Db::queryRow("select * from #__study where study_id = '".$_v['study_id']."' and study_price = '0' and study_points = '0' ")){?>
		$("#photo").hide();
		$("#video").hide();
		$("#play").append('<source src="<?php echo $_v['vedio_url']?>" type="video/mp4"  />');
		$("#play").show();
		
		<?php }else if( Db::queryRow("select * from #__study_log where study_id = '".$_v['study_id']."' GROUP by member_id")){?>
		   	
		    $.ajax({
			type:"post",
			url:"index.php?act=university_detail&op=video_link",
			dataType:"json",
			data:{study_id:<?php echo $_v['study_id']?>},
			success:function(json){
			if(json.success==1){
			$("#photo").hide();
			$("#video").hide();
			$("#play").show();
				}else{
					alert("视频播放错误");
				}
				
			}
			
			});
				$("#play").append('<source src="<?php echo $_v['vedio_url']?>" type="video/mp4"  />');

				
				 <?php }else{?>

	<?php }?>
	function download(){
		$.ajax({
			type:"post",
			url:"index.php?act=member_lesson&op=study_download",
			dataType:"json",
			data:{
				study_id:<?php echo $_v['study_id']?>
			},
			success:function(json){
				if(json.success==1){
				$("#xiazai").attr("href","<?php echo $_v['vedio_url']?>"); 
				document.getElementById('xiazai').click(); 
				}else{
					alert("下载失败");
				}
			}
			
		});

	}
 </script>
<script>
	function iconShow(msg) 
	{
	     var i = new Date().getTime() / 1000;
        var c = Math.floor(endTime - i);
        if (c > 0) {
            setTimeout('iconShow()', 1000);
            $("#guanzhu").html(msg);
            var a = document.documentElement.clientWidth || document.body.clientWidth;
            var domW = $('#save').innerWidth();
            var d = (a / 2) - (domW / 2);
            $('#save').css('left',d + 'px');
            var h = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
            var b = document.documentElement.clientHeight || document.body.clientHeight;
            var domH = $('#save').innerHeight();
            var g = h - (domH / 2) + (b / 2);
            $('#save').css('top',g + 'px');
            $(".pop-attention").show()
        } else {
            $(".pop-attention").hide()
        }
}
</script>


